package com.adgox.tiantianbiting.adapter;

import android.view.View;
import android.widget.ImageView;

import com.adgox.tiantianbiting.R;
import com.adgox.tiantianbiting.bean.MessageBean;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class MessageAdapter extends BaseMultiItemQuickAdapter<MessageBean.DataBeanX.DataBean, BaseViewHolder> {

    public MessageAdapter(List<MessageBean.DataBeanX.DataBean> data) {
        super(data);
        addItemType(MessageBean.DataBeanX.DataBean.Data,R.layout.item_system_message);
        addItemType(MessageBean.DataBeanX.DataBean.Date,R.layout.item_system_date);
    }

    @Override
    protected void convert(BaseViewHolder helper, MessageBean.DataBeanX.DataBean item) {
//        sysMsgType (integer, optional): 系统消息类型 0.奖励听币通知 1.奖励可提现通知 2.签到 3.欢迎礼包已发送 4.栏目降价 5.栏目购买成功 6.充值 7.栏目付费提醒 ,
        switch (helper.getItemViewType()) {
            case MessageBean.DataBeanX.DataBean.Data:
                ImageView view = helper.getView(R.id.imageView2);
                switch (item.getSysMsgType()) {
                    case 0:
                        view.setImageResource(R.drawable.img1);
                        helper.setText(R.id.textView6, "奖励听币通知");
                        break;
                    case 1:
                        view.setImageResource(R.drawable.img2);
                        helper.setText(R.id.textView6, "奖励可提现通知");
                        break;
                    case 2:
                        view.setImageResource(R.drawable.img3);
                        helper.setText(R.id.textView6, "签到提醒");
                        break;
                    case 3:
                        view.setImageResource(R.drawable.img4);
                        helper.setText(R.id.textView6, "欢迎礼包已发送");
                        break;
                    case 4:

                        view.setImageResource(R.drawable.img5);
                        helper.setText(R.id.textView6, "栏目降价通知");
                        break;
                    case 5:
                        view.setImageResource(R.drawable.img6);
                        helper.setText(R.id.textView6, "栏目购买成功");
                        break;
                    case 6:
                        view.setImageResource(R.drawable.img7);
                        helper.setText(R.id.textView6, "充值成功");
                        break;
                    case 7:
                        view.setImageResource(R.drawable.img8);
                        helper.setText(R.id.textView6, "栏目付款提醒");
                        break;
                }
                helper.setText(R.id.des, item.getContent());
                helper.setText(R.id.time, item.getCreateTimeStr());
                break;
            case MessageBean.DataBeanX.DataBean.Date:
                helper.setText(R.id.time, item.getCreateTimeStr());
                break;
        }

    }
}
